// 深拷贝
/**
 *
 * @param {target} 需要拷贝的对象
 */

export function deepCopy (target, map = new WeakMap()) {
  if (typeof target === 'object') {
    let newObj = Array.isArray(target) ? [] : {}
    if (map.get(target)) {
      return map.get(target)
    }
    map.set(target, newObj)
    for (const key in target) {
      newObj[key] = deepCopy(target[key], map)
    }
    return newObj
  } else {
    debugger
    target
  }
}
